package com.raos.userservice.config;

import com.raos.userservice.discovery.ServiceDiscoveryImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

import javax.annotation.Resource;

/**
 * 自定义服务发现配置类(将服务发现类纳入 spring IoC的管理中)
 *
 * @author raos
 * @emil 991207823@qq.com
 * @date 2022/9/6 21:33
 */
@Configuration
public class ZookeeperDiscoveryAutoConfiguration {

    @Resource
    private Environment environment;

    @Bean
    public ServiceDiscoveryImpl serviceDiscovery() {
        return new ServiceDiscoveryImpl(environment.getProperty("zk.server"));
    }

}










